Repository navigation
Opsx enable system parameters globally - #640
Conversation
8638d98 to
48991e4
Compare
Update api.py
Otherwise, before this commit, once a Core API call was done with a max_cores set, this max_cores leaked into subsequent Core API calls, because a new runner was created and, crucially, then set via set_runner so that subsequent Core API calls use it.
Indeed, the lock is not needed, because the _CURRENT_ENVIRONMENT dictionary is never mutated in-place. It is replaced atomically.
- test that changing default values set-up a local runner that inherits unchanged runner settings; - test that the default system parameters are just stored for non-local (e.g. Docker) runners; - test that the default system parameters are not committed if the runner creation fails for some reason.
If the current environment gets some of the KHIOPS_* system-parameter environment variables set to empty values (which is possible via external process, e.g. CI), then they are not set accordingly as a default variable.
4ff1404 to
ebc6448
Compare
| return _khiops_runner | ||
|
|
||
|
|
||
| def get_runner(): |
There was a problem hiding this comment.
One may wonder without reading the docstrings the difference between peek_runner and get_runner. As getters has usually no side-effect, the latter may be renamed from get_runner to get_or_create_runner (à la Django)
There was a problem hiding this comment.
Yes, I agree, but this would entail the change of an existing (albeit internal) API, as opposed to a mere addition to the said API (which peek_runner does). However, this could be done in a different PR IMHO:
- rename
get_runnertoget_or_create_runner; - rename
peek_runnertoget_runner.
| return runner | ||
|
|
||
|
|
||
| def _get_task_runner(max_cores): |
There was a problem hiding this comment.
Maybe worth declaring a named parameter (max_cores=None) so that it is obvious that it is optional
There was a problem hiding this comment.
We could do that, but this "private" helper function is only called in a single place, and the None is for an input via system_settings.max_cores which would actually be None; it is not really a "default" value for this helper IMHO.
tramora
left a comment
There was a problem hiding this comment.
A couple of minor remarks you have already taken into account
closes #622
TODO Before Asking for a Review
main(ormain-v10)Unreleasedsection ofCHANGELOG.md(no date)index.html